<?php
/**
 * IG_View_Helper_CkEditor
 *
 * @author maomao.thx@gmail.com
 * @copyright Copyright (c) 2009 Green Shore (http://www.iwgame.com)
 * @version $Id: CkEditor.php 524 2011-05-24 01:44:20Z mmxie $
 */
class IG_View_Helper_CkEditor extends Zend_View_Helper_Abstract
{
    public function ckEditor($name, $content, $config=array(), $events=array())
    {
        $view = $this->view;

        $editor = new IG_Editor_CkEditor();

        $view->headScript()
            ->appendFile($editor->basePath . 'ckeditor.js');

        $html = $editor->build($name, $content);

        $js = $editor->script($name, $config, $events);

        $view->headScript()
            ->appendScript($js);
        return $html;
    }
}